<?
require("inc/common.php");
require("bin/db.php");
$VALIDATE_USER="no";
require("bin/fc.php");

$status = "Please enter your username and password to login. ";
$action = $_POST["action"];
$username = $_POST["username"];
$password = $_POST["password"];
if (NULL!=$action){

		if (!validate($username,$password)){
	
		   $status = "<font color=red>Invalid username or password! Please try again.</font>";
		   
		   
	   }else{
	
		$table = "user_profile";
		$Query = "SELECT name, email, type FROM $table WHERE username='$username' AND BINARY password='$password'";
		$r=myQUERY($Query);
	
		$name = $r[0][0];
		$type = $r[0][2];
	
		//session_start(); 
		session_register("admin_username");
		session_register("admin_name");
		session_register("admin_type");
	
		$admin_username = $username;
		$admin_name = $name;
		$admin_type = $type;
	
		if (!$r) $admin_type = 9;
	
		
		header("location:". $language ."main.php");
	
		exit();
		}
}


?>

<html>
<head>
<title>Venus</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" href="inc/css.css" type="text/css">
<script language="javascript" src="inc/admin.js"></script>
</head>

<body bgcolor="8DAAE6" text="#000000">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form name="form1" method="post" action="<?echo $PHP_SELF?>">
<input name="action" type="hidden" value="login">

  <table width="440" border="0" align="center">
    <tr> 
      <td><span class="Heading">VENUS</span></td>
    </tr>
    <tr> 
      <td> <p><?print($status)?></p>
        <table border="0" align="right">
          <tr> 
            <td>
              <div align="right">username</div>            </td>
            <td> 
              <input type="text" name="username" id="username" class="text">            </td>
          </tr>
          <tr> 
            <td>
              <div align="right">password</div>            </td>
            <td> 
              <input type="password" name="password" id="password" class="text">            </td>
          </tr>
          
          <tr> 
            <td>&nbsp;</td>
            <td> 
              <div align="right">
                <input type="submit" name="Login" value="Login" class="button">
              </div>            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>
</body>
</html>
